<?php

class ActionBrowseUsers extends Action {

	public function GetTitle(){ return Lemma::Users(); }
	public function IsPermitted(){ return User::GetCurrent()->IsAdministrator(); }
	public function GetIconName(){ return 'oxy/ico/User'; }
	public function GetParentAction(){ return new ActionConsole(); }


	public function Render(){


		$act = $this->GetParentAction();
		echo '<a href="'.new Html($act).'">'.new Icon('oxy/ico/Up').' '.$act->GetTitle().'</a>';
		echo '<br/><br/>';

		echo '<table class="report" width="100%" cellspacing="0" cellpadding="0" border="0">';

		echo '<tr>';
		echo '<th>'.new Spacer().'</th>';
		echo '<th>'.Lemma::Username().'</th>';
		echo '<th class="expand">'.Lemma::Email().'</th>';
		echo '</tr>';


		$g = UserGroup::Retrieve(UserGroup::idAdministrators);

		$i = 0;
		foreach ($g->GetUsers() as $u){
			$act = new ActionEditUser($u);
			echo '<tr'.(++$i%2==0?' class="alt"':'').'>';

			echo '<td>'.$i.'.</td>';
			echo '<td><a href="'.new Html($act).'">'.$u->Username.'</a></td>';
			echo '<td>'.$u->Email.'</td>';
			echo '</tr>';

		}
		echo '</table>';


		echo '<br/>';
		$act = new ActionCreateUser();
		echo $act->GetLink();

	}
}


?>
